// 测绘单位我的待办
<template>
  <div id="MyTodoList">
    <ul v-if="listData.length>0">
      <li v-for="(item,index) in listData" :key="index" @click="listClick(item)">
        <p style="font-weight: bold; height: 30px">
          <span style="float: left">{{item.WF_NAME}}</span>
          <span style="float: right">{{ item.HOUSEAPPLICANT }}</span>
        </p>
        <p style="font-size: 14px; color: #848484; height: 30px">
          <span style="float: left">进度：{{ item.NODE_NAME }}</span>
          <span style="float: right">申请时间：{{ item.APPLYTIME?item.APPLYTIME.split(' ')[0]:'' }}</span>
        </p>
        <p style="font-size: 14px; color: #848484; height: 30px">
          <span style="float: left">地址：{{ item.CONSTRUCITONADDRESS }}</span>
        </p>
      </li>
    </ul>
    <ul v-else>
      <div style="height: 60vh;text-align:center;padding-top: 20vh;">
        <div style="margin-bottom: 10px;">
          <img src="https://nfzjszlb.jst.zj.gov.cn/serverfile/zheliban/icon/DSF/50.png" />
        </div>
        <div>暂无数据</div>
      </div>
    </ul>
  </div>
</template>

<script>
import { FileServerProxy } from '@/utils/api'
export default {
  name: 'MyTodoList',
  data() {
    return {
      listData: [
        // {
        //   HOUSEAPPLICANT: '某某某',
        //   NODE_NAME: '危改整治',
        //   PROC_NAME: '危房鉴定',
        //   APPLYTIME: '2022-03-24',
        //   PERMANENTADDR: '地址'
        // }
      ]
    }
  },
  methods: {
    getListData: async function () {
      let params = {
        accessCode: '688bd3883572440a859dfd8ba9194e7b',
        
        params: {
          dataguid: 'b4afbf87-17d3-4475-94f7-cffb3d5352f9',
          searchObject: JSON.stringify([]),
          token: window.localStorage.getItem('token')
        }
      }
      const res = await FileServerProxy(params)
      this.listData = JSON.parse(res.data.data).Data
    },
    listClick(item) {
      if (item.WF_GUID == '{612C9C60-8D18-4D23-BF32-E9D9D01BB0EA}' && item.NODE_GUID == '{B6C36D7F-E42E-49EC-B7EA-9CCF2449DB2A}') {
        this.$router.push({
          path: '/locationFY', //定位放样
          query: { data: JSON.stringify(item) }
        })
      } else if (item.WF_GUID == '{460B4B5F-C3C2-4D4D-A702-17D4B4A3252F}' && item.NODE_GUID == '{0493F00B-6F0A-4E14-9315-9DF68EE6E755}') {
        this.$router.push({
          path: '/trenchLine', //基槽验线
          query: { data: JSON.stringify(item) }
        })
      } else if (item.WF_GUID == '{7F042B34-7091-4884-A5D6-A615AE55497D}' && item.NODE_GUID == '{7D278D07-FEEB-410B-8319-1D0C85B10890}') {
        this.$router.push({
          path: '/oneModel', //一层立模
          query: { data: JSON.stringify(item) }
        })
      } else if (item.WF_GUID == '{8FAD71FB-7756-4F0A-BEE8-4F6397B075A8}' && item.NODE_GUID == '{22FD5C82-A491-420C-8F1B-5EBDDE0EC5FE}') {
        this.$router.push({
          path: '/Acceptance', //竣工验收
          query: { data: JSON.stringify(item) }
        })
      } else if (item.WF_GUID == '{9FF1C524-B55F-4A45-83B3-6EA46CF32092}' && item.NODE_GUID == '{517211B4-3740-4F49-9DA4-7BC3C9A6F9EA}') {
        this.$router.push({
          path: '/SitesurveyDsf', //现场踏勘
          query: { data: JSON.stringify(item) }
        })
      }
      //   this.$router.push({
      //     path: '/baseProject', //申请详情
      //     query: { data: JSON.stringify(item) }
      //   })



    }
  },
  mounted() {
    this.getListData()
    if (ZWJSBridge) {
      ZWJSBridge.setTitle({
        title: '我的待办'
      })
        .then(res => {
        })
        .catch(err => {
        })
    }
  }
}
</script>

<style scoped lang="scss">
#MyTodoList {
  height: 100vh;
  overflow: auto;
  padding: 10px;
  ul li {
    padding-top: 10px;
    border-bottom: 1px solid #d2d2d2;
  }
}
</style>
